class PowerPort220V {
  PowerSupply() {
    console.log("110V 电源接口向外输出了 220V 电压")
  }
}

class PowerPort110V {
  PowerSupply() {
    console.log("110V 电源接口向外输出了 110V 电压")
  }
}

// 适配器
interface Adapter {
  PowerSupply()
}

class NoteBook {
  Work() {
    console.log('笔记本正常工作')
  }
}

class Adapter110V extends PowerPort110V implements Adapter {
  noteBook = new NoteBook()

  PowerSupply(): void {
    super.PowerSupply()
    console.log('适配器将电压转换为笔记本所需要的')
    this.noteBook.Work()
  }
}

class Adapter220V extends PowerPort220V implements Adapter {
  noteBook = new NoteBook()

  PowerSupply(): void {
    super.PowerSupply()
    console.log('适配器将电压转换为笔记本所需要的')
    this.noteBook.Work()
  }
}

(function () {
  console.log('出国以前使用笔记本')
  let adapter: Adapter = new Adapter220V()
  adapter.PowerSupply()
  adapter = new Adapter110V()
  adapter.PowerSupply()
}())